package com.team11.server.controller.admin;

import com.team11.server.service.admin.Admin_UpdatePleader_Service;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
@CrossOrigin
@RestController
@Api(tags = "管理员接口")
public class Admin_UpdatePleader_Controller {
    @Autowired
    private Admin_UpdatePleader_Service admin_updatePleader_service;
    @ApiOperation("设置组长(需要小组id和学生学号)")
    @PostMapping("/UpdatePleader")
    public String updatePleader(Integer NewPid,String sNumber){
        HashMap<String,Object> map=new HashMap<String,Object>();
        map.put("NewPid",NewPid);
        map.put("sNumber",sNumber);
        String o=admin_updatePleader_service.SelPleader(NewPid);
        String s=admin_updatePleader_service.SelSInP(map);
        if (s.equals("1")) {
            if (o.equals("1")) {
                return admin_updatePleader_service.updatePleader(map);
            }
            else return o;
        }
        else return s;
    }
}
